package jdk8;

import java.util.function.Supplier;

//构造方法引用
public class TestConstructorMethodRef01 {
    public static void main(String[] args) {
        //1.传统方式(构建供给型接口对象)
        Supplier<Object> s1=new Supplier<Object>() {
            @Override
            public Object get() {
                return new Object();
            }
        };
        System.out.println("s1 = " + s1.get());
        //2.Lambda方式
        Supplier<Object> s2=()->new Object();
        System.out.println("s2 = " + s2.get());
        //3.构造方法引用"类名::new"
        Supplier<Object> obj=Object::new;
        System.out.println("obj = " + obj.get());
    }
}
